package cn.evun.tms.generator.handler.impl;

import cn.evun.tms.generator.Constants;
import cn.evun.tms.generator.config.Configuration;
import cn.evun.tms.generator.handler.BaseHandler;
import cn.evun.tms.generator.model.DaoInfo;

import java.io.File;

public class DaoHandler extends BaseHandler<DaoInfo> {

	public DaoHandler(String ftlName, DaoInfo info) {
		this.ftlName = ftlName;
		this.info = info;
		this.savePath = Configuration.getString("base.baseDir") + File.separator + Configuration.getString("dao.path")
				+ File.separator + info.getClassName() + Constants.FILE_SUFFIX_JAVA;

	}

	@Override
	public void combileParams(DaoInfo info) {
		this.param.put("packageStr", info.getPackageStr());
		this.param.put("importStr", info.getImportStr());
		this.param.put("importStrDto", info.getImportStrDto());
		this.param.put("entityDesc", info.getEntityInfo().getEntityDesc());
		this.param.put("className", info.getClassName());
		this.param.put("entityClassName", info.getEntityInfo().getClassName());
		this.param.put("dtoClassName", info.getDtoInfo().getClassName());
		this.param.put("entityName", info.getEntityInfo().getEntityName());
	}

}
